package day06;

public class MethodMemo {
    public static void main(String[] args) {
       /* sayhi("zhangsan");
        sayhello("JLJY",27);
        sayhello("lisi",30);
        address("天津","长安",89988,6);
        double a = getNum();
        System.out.println(a);
        float b = getNumber();
        System.out.println(b);
        int add = plus(8,7);
        System.out.println(add);
        sayhi();
        int c = 10,d = 20;
        int Multiply = multiply(10,2);
        int multiply = multiply(c,d);
        System.out.println(Multiply);
        System.out.println(multiply);*/
        /*
                 0.0--------------0.99999999999
        *100     0.0--------------99.9999999999
        *100+1   1.0--------------100.99999999899
        *91     0.0---------------90.99999999909
         */
        saygoodbye("鼎鼎大名的V,",28);
        saygoodbye("fa",31);
        aMethod();
        System.out.println("444");//1,2,3,4

    }
    //有参有返回值
    public static int [] testArrays(int len,int max){
        int [] arr = new int[len];
        for(int i =0;i<arr.length;i++){
            arr [i] = (int)(Math.random()*(max));
        }
        return arr;
    }
    public static int plus(int num1,int num2){
        int num = num1+num2;
        return num;//返回的是num里的那个数
    }
    public static int multiply(int num1,int num2){
        int result = num1*num2;
        return result;
    }
    //有参无返回值
    public static void saygoodbye(String name,int age){
        if(age>30){
            return;
        }
        System.out.println("我是"+name+"今年"+age+"岁。");
    }
    public static void sayhi(String name){
        System.out.println("我的名字是"+name);
    }
    public static void sayhello(String name,int age){
        System.out.println("我是"+name+","+age+"岁。");
    }
    public static void address(String address,String block,int num,int cost){
        System.out.println(address+"市区"+block+"街道，"+num+"号"+cost+"层");
    }
    //无参有返回值
    public static double getNum(){
        return 8.88;
    }
    public static float getNumber(){
        return (float)9.88;
    }
    public static int [] testArray(){
        int [] arr = new int[10];
        for(int i =0;i<arr.length;i++){
            arr [i] = (int)(Math.random()*100);
        }
        return arr;
    }
    //无参无返回值
    public static void sayhi(){
        System.out.println("hi");
    }

    public static void aMethod(){
        System.out.println("111");
        bMethod();
        System.out.println("333");
    }
    public static void bMethod(){
        System.out.println("222");
    }
}
